package com.sfhk.dao.impl;

import com.sfhk.dao.ProductDao;
import com.sfhk.domain.Product;
import com.sfhk.utils.C3P0Utils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class ProductDaoImpl implements ProductDao {

    private JdbcTemplate template = new JdbcTemplate(C3P0Utils.getDateSource());
    @Override
    public List<Product> findAll() {
        String sql = "select * from product";
        List<Product> list = template.query(sql,new BeanPropertyRowMapper<>(Product.class));
        return list;
    }

    @Override
    public void deleteById(String pid) {

    }
}
